package j180.javaoo.homework;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 计算某年、某月、某日和某年、某月、某日之间的天数间隔和周数。
 */
public class HomeWork03 {
    public static void main(String[] args){
        LocalDate ld1 = LocalDate.of(2020, 11,10);
        LocalDate ld2 = LocalDate.of(2019, 8, 7);
        int days = 0;
        while(true){
            if(ld1.plusDays(days).toString().equals(ld2.toString()) || ld1.minusDays(days).toString().equals(ld2.toString()))
                break;
            else
                days++;
        }

        System.out.println("相隔"+days+"天");
        double weeks = days / 7.0;
        System.out.println("相隔"+weeks+"周");
    }
}
